package com.cloud.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.cloud.domain.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 登录日志记录
 *
 * @author yzj
 * @since 2022-05-13
 */
@Data
@Schema(name = "SysLogLogin对象", description = "系统管理")
@TableName("sys_login_logs")
public class SysLoginLogs extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId(value = "login_id", type = IdType.AUTO)
    private Integer loginId;

    @Schema(description = "系统编号")
    private String sysCode;

    @Schema(description = "登录方式")
    @Excel(name = "登录方式", orderNum = "1", width = 15)
    private String loginMethod;

    @Schema(description = "登录设备")
    @Excel(name = "登录设备", orderNum = "2", width = 15)
    private String loginDevice;

    @Schema(description = "用户账号")
    @Excel(name = "用户账号", orderNum = "3", width = 15)
    private String userName;

    @Schema(description = "用户昵称")
    @Excel(name = "用户昵称", orderNum = "4", width = 15)
    private String nickName;

    @Schema(description = "主机地址")
    @Excel(name = "主机地址", orderNum = "5", width = 15)
    private String operIp;

    @Schema(description = "登录状态（0成功, 1失败）")
    @Excel(name = "登录状态", orderNum = "6", width = 10, replace = {"成功_0", "失败_1"})
    private Integer loginStatus;

    @Schema(description = "登录结果")
    @Excel(name = "登录结果", orderNum = "7", width = 15)
    private String loginMsg;

    @Schema(description = "登录时间")
    @Excel(name = "登录时间", orderNum = "8", width = 15)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginTime;

}
